﻿@model QLMB.ViewModels.InfoFlight

@{
    ViewBag.Title = "ConfirmTicket";
}

<script type="text/javascript">
     $(function () {
        $('#dialog').dialog({
            autoOpen: false,
            width: 400,
            height: 'auto',
            resizable: false,
            title: 'Thong tin ve phi va gia ve',
            modal: true,
            open: function(event, ui) {
                $(this).load("@Url.Action("_FeeInfo")");
            },
            buttons: {
                "Close": function () {
                    $(this).dialog("close");
                }
            }
        });


        $('#feeinfo').click(function () {
            $('#dialog').dialog('open');
        });
    });

    $(function () {
        $('#detailinfo1').dialog({
            autoOpen: false,
            width: 800,
            height: 'auto',
            resizable: false,
            title: 'Thong tin chuyen bay',
            modal: true,
            open: function(event, ui) {
                $(this).load("@Url.Action("_DetailFlight", new {macb = Model.MaChuyenBayDi})");
            },
            buttons: {
                "Close": function () {
                    $(this).dialog("close");
                }
            }
        });


        $('#detail1').click(function () {
            $('#detailinfo1').dialog('open');
        });
    });

    $(function () {
        $('#detailinfo2').dialog({
            autoOpen: false,
            width: 800,
            height: 'auto',
            resizable: false,
            title: 'Thong tin chuyen bay',
            modal: true,
            open: function(event, ui) {
                $(this).load("@Url.Action("_DetailFlight", new {macb = Model.MaChuyenBayVe})");
            },
            buttons: {
                "Close": function () {
                    $(this).dialog("close");
                }
            }
        });


        $('#detail2').click(function () {
            $('#detailinfo2').dialog('open');
        });
    });
</script>

<h2>XAC NHAN LAI VE</h2>
<h3>Thong tin ve da dat</h3>
<span id = "feeinfo" class = "ButtonLink">Nhap vao de tim hieu thong tin ve phi</span>
<div id="dialog" style="overflow: hidden;"></div>
<br />

@using (Html.BeginForm())
{
    <table>
        <tr>
            <td>
                <div style = "width:100px;">
                    <b>Di:</b><br />
                    @string.Format("{0:hh:mm}", ViewBag.CBDi.NgayDi)<br />
                    <b>Den:</b><br />
                    @string.Format("{0:hh:mm}", ViewBag.CBDi.NgayDen)<br />
                </div>
            </td>
            <td>
                <div style = "width:200px;">
                    @string.Format("{0:dddd, MMMM dd yyyy}", ViewBag.CBDi.NgayDi)<br />
                    @ViewBag.CBDi.DUONGBAY.SANBAY.THANHPHO.TenTP, 
                    @ViewBag.CBDi.DUONGBAY.SANBAY.THANHPHO.QuocGia<br />
                    @string.Format("{0:dddd, MMMM dd yyyy}", ViewBag.CBDi.NgayDen)<br />
                    @ViewBag.CBDi.DUONGBAY.SANBAY1.THANHPHO.TenTP, 
                    @ViewBag.CBDi.DUONGBAY.SANBAY1.THANHPHO.QuocGia<br />
                </div>
            </td>
            <td>
                <b>@ViewBag.CBDi.MAYBAY.HangMB</b><br />
                @ViewBag.CBDi.DUONGBAY.HanhTrinh /
                @ViewBag.CBDi.MaMB<br />
                Loai dich vu: @ViewBag.LoaiDVDi.TenDichVu<br />
                <span id = "detail1" class = "ButtonLink" name = "@Model.MaChuyenBayDi">Thong tin chi tiet</span>
                <div id="detailinfo1" style="overflow: hidden;"></div>
            </td>
        </tr>
        @if (Model.Loaive == "Khu hoi")
        {
            <tr>
            <td>
                <div style = "width:100px;">
                    <b>Di:</b><br />
                    @string.Format("{0:hh:mm}", ViewBag.CBVe.NgayDi)<br />
                    <b>Den:</b><br />
                    @string.Format("{0:hh:mm}", ViewBag.CBVe.NgayDen)<br />
                </div>
            </td>
            <td>
                <div style = "width:200px;">
                    @string.Format("{0:dddd, MMMM dd yyyy}", ViewBag.CBVe.NgayDi)<br />
                    @ViewBag.CBVe.DUONGBAY.SANBAY.THANHPHO.TenTP, 
                    @ViewBag.CBVe.DUONGBAY.SANBAY.THANHPHO.QuocGia<br />
                    @string.Format("{0:dddd, MMMM dd yyyy}", ViewBag.CBVe.NgayDen)<br />
                    @ViewBag.CBVe.DUONGBAY.SANBAY1.THANHPHO.TenTP, 
                    @ViewBag.CBVe.DUONGBAY.SANBAY1.THANHPHO.QuocGia<br />
                </div>
            </td>
            <td>
                <b>@ViewBag.CBVe.MAYBAY.HangMB</b><br />
                @ViewBag.CBVe.DUONGBAY.HanhTrinh /
                @ViewBag.CBVe.MaMB<br />
                Loai dich vu: @ViewBag.LoaiDVVe.TenDichVu<br/>
                <span id = "detail2" class = "ButtonLink" name = "@Model.MaChuyenBayVe">Thong tin chi tiet</span>
                <div id="detailinfo2" style="overflow: hidden;"></div>
            </td>
            </tr>
        }
        <tr>
            <td>
            <b>TONG:</b>
            </td>
            <td align = "center">
            <b>Gia ve (da bao gom chi phi dich vu):</b><br />
            <b>Phi phuc vu hanh khach:</b><br />
            <u>San bay di:</u><br />
            Nguoi lon: @Model.SoNguoiLon x @string.Format("{0:0,0}", ViewBag.ThueSbDi)<br />
            Tre em: @Model.SoTreEm x @string.Format("{0:0,0}", ViewBag.ThueSbDi / 2)<br />
            @if (Model.Loaive == "Khu hoi")
            {
                string t1 = "Nguoi lon: " + @Model.SoNguoiLon.ToString() + " x " + (string)string.Format("{0:0,0}", @ViewBag.ThueSbVe);
                string t2 = "Tre em: " + @Model.SoTreEm.ToString() + " x " + (string)string.Format("{0:0,0}", @ViewBag.ThueSbVe / 2);
                <u>@Html.Label("San bay ve:")</u> <br />
                @Html.Label(t1);<br />
                @Html.Label(t2);<br />
            }
            <b>Thue gia tri gia tang: (10% gia ve va gia dich vu di kem): </b>
            </td>


            <td align = "left">
            (@Model.SoNguoiLon + @Model.SoTreEm) x @string.Format("{0:0,0}",ViewBag.TienVeDi)
            @if (Model.Loaive == "Khu hoi")
            {
                string temp = "+ (" + Model.SoNguoiLon + "+" + Model.SoTreEm + ") x " + (string)string.Format("{0:0,0}", ViewBag.TienVeVe);
                @Html.Label(temp)
            }
            <br />
            <br />
            <br />
            @string.Format("{0:0,0}", ViewBag.TienThueNguoiLonDi)<br />
            @string.Format("{0:0,0}", ViewBag.TienThueTreEmDi)<br />
            @if (Model.Loaive == "Khu hoi")
            {
                <br />
                @Html.Label((string)string.Format("{0:0,0}", ViewBag.TienThueNguoiLonVe))<br />
                @Html.Label((string)string.Format("{0:0,0}", ViewBag.TienThueTreEmVe))<br />
            }
            @string.Format("{0:0,0}", ViewBag.ThueVAT)
            </td>
        </tr>
        <tr>
            <td colspan = "2" align = "center">
                <b>GIA CUA VE</b>
            </td>
            <td>
                @string.Format("{0:0,0}", Model.TongTien)
            </td>
        </tr>
    </table>
    <input type="submit" value="Xac nhan" />
}